<?php
function connect() {
	$link = mysql_pconnect('mysql.connect2congress.com', 'c2v2', 'rueiwoqp');
	if (!$link) {
   		die('Could not connect: ' . mysql_error());
	}
	return $link;

}

function disconnect($link) {
	mysql_close($link);
	return true;
}

function dirList ($directory)
{

    // create an array to hold directory list
    $results = array();

    // create a handler for the directory
    $handler = opendir($directory);

    // keep going until all files in directory have been read
    while ($file = readdir($handler)) {

        // if $file isn't this directory or its parent,
        // add it to the results array
        if ($file != '.' && $file != '..')
            $results[] = $file;
    }

    // tidy up: close the handler
    closedir($handler);

    // done!
    return $results;

}

function dirListXML ($directory)
{

    // create an array to hold directory list
    $results = array();

    // create a handler for the directory
    $handler = opendir($directory);

    // keep going until all files in directory have been read
    while ($file = readdir($handler)) {

        // if $file isn't this directory or its parent,
        // add it to the results array
        if ($file != '.' && $file != '..' && substr($file,strlen($file)-3,3) == "xml")
            $results[] = $file;
    }

    // tidy up: close the handler
    closedir($handler);

    // done!
    return $results;

}

?>